﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebAppAsp_PrimerPrograma
{
    public partial class Listbox : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack){
                ListBox1.Items.Add("Elemento 0 de la listBox1");
                ListBox1.Items.Add("Elemento 1 de la listBox1");
                ListBox1.Items.Add("Elemento 2 de la listBox1");
                ListBox1.Items.Add("Elemento 3 de la listBox1");
            }
        }

        protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox2.Items.Add(ListBox1.SelectedValue);
            ListBox1.Items.Remove(ListBox1.SelectedValue);
        }
    }
}